home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-1.iso / Files / Tele / C / Comet2.1.3.sit / include / net.h < prev    next >
MacBinary  |  1990-07-26  |  5.4 KB  |  [TEXT/????]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: net.h

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
10% dexvert Jesper Olsen Module (music/jesperOlsen) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Thu Jul 26 15:45:25 1990, modified Thu Jul 26 15:45:25 1990, creator '????', type ASCII, 4919 bytes "net.h" , at 0x13b7 382 bytes resource default (weak)
99% file data default
49% TrID Macintosh plain text (MacBinary) default
33% TrID TTComp archive compressed (bin-2K) default (weak)
16% TrID MacBinary 2 default (weak)
0% TrID Sybase iAnywhere database files default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[????]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 05 6e 65 74 2e 68 00 | 00 00 00 00 00 00 00 00 |..net.h.|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 3f 3f 3f | 3f 00 00 00 00 00 00 00 |.TEXT???|?.......|
|00000050| 00 00 00 00 00 13 37 00 | 00 01 7e a2 d4 f8 d5 a2 |......7.|..~.....|
|00000060| d4 f8 d5 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 a9 0e 00 00 |........|........|
|00000080| 2f 2a 20 20 43 6f 70 79 | 72 69 67 68 74 20 31 39 |/* Copy|right 19|
|00000090| 38 33 20 62 79 20 74 68 | 65 20 4d 61 73 73 61 63 |83 by th|e Massac|
|000000a0| 68 75 73 65 74 74 73 20 | 49 6e 73 74 69 74 75 74 |husetts |Institut|
|000000b0| 65 20 6f 66 20 54 65 63 | 68 6e 6f 6c 6f 67 79 20 |e of Tec|hnology |
|000000c0| 20 2a 2f 0d 0d 2f 2a 0d | 09 43 6f 70 79 72 69 67 | */../*.|.Copyrig|
|000000d0| 68 74 20 43 6f 72 6e 65 | 6c 6c 20 55 6e 69 76 65 |ht Corne|ll Unive|
|000000e0| 72 73 69 74 79 20 31 39 | 38 36 2e 20 20 41 6c 6c |rsity 19|86. All|
|000000f0| 20 72 69 67 68 74 73 20 | 61 72 65 20 72 65 73 65 | rights |are rese|
|00000100| 72 76 65 64 2e 0d 0d 09 | 41 73 20 6f 66 20 34 2f |rved....|As of 4/|
|00000110| 31 30 2f 38 36 3a 0d 09 | 54 68 69 73 20 73 6f 75 |10/86:..|This sou|
|00000120| 72 63 65 20 66 69 6c 65 | 20 6d 61 79 20 68 61 76 |rce file| may hav|
|00000130| 65 20 6e 6f 20 63 68 61 | 6e 67 65 73 20 66 72 6f |e no cha|nges fro|
|00000140| 6d 20 74 68 65 20 4d 2e | 49 2e 54 20 6f 72 69 67 |m the M.|I.T orig|
|00000150| 69 6e 61 6c 0d 09 6f 74 | 68 65 72 20 74 68 61 6e |inal..ot|her than|
|00000160| 20 74 68 69 73 20 6e 6f | 74 69 63 65 3b 20 62 75 | this no|tice; bu|
|00000170| 74 20 69 74 20 68 61 73 | 20 62 65 65 6e 20 74 65 |t it has| been te|
|00000180| 73 74 65 64 20 61 73 20 | 70 61 72 74 20 6f 66 20 |sted as |part of |
|00000190| 0d 09 43 6f 72 6e 65 6c | 6c 27 73 20 41 7a 74 65 |..Cornel|l's Azte|
|000001a0| 63 2d 43 20 70 6f 72 74 | 2e 20 20 53 65 65 20 6e |c-C port|. See n|
|000001b0| 6f 74 69 63 65 2e 68 0d | 0d 2a 2f 0d 0d 2f 2a 20 |otice.h.|.*/../* |
|000001c0| 20 64 65 66 69 6e 65 27 | 73 20 66 6f 72 20 6c 65 | define'|s for le|
|000001d0| 76 65 6c 73 20 6f 66 20 | 74 72 61 63 69 6e 67 20 |vels of |tracing |
|000001e0| 61 6e 64 20 66 6f 72 20 | 73 75 63 63 65 73 73 20 |and for |success |
|000001f0| 61 6e 64 20 66 61 69 6c | 75 72 65 0d 20 20 20 20 |and fail|ure. |
|00000200| 61 64 64 65 64 2c 20 4a | 61 6e 75 61 72 79 20 31 |added, J|anuary 1|
|00000210| 39 38 34 2e 20 20 20 20 | 20 3c 4a 2e 20 48 2e 20 |984. | <J. H. |
|00000220| 53 61 6c 74 7a 65 72 3e | 0d 09 38 2f 31 32 2f 38 |Saltzer>|..8/12/8|
|00000230| 34 20 2d 20 61 64 64 65 | 64 20 74 68 65 20 63 75 |4 - adde|d the cu|
|00000240| 73 74 6f 6d 20 73 74 72 | 75 63 74 75 72 65 20 66 |stom str|ucture f|
|00000250| 6f 72 20 65 61 63 68 20 | 6e 65 74 2c 20 61 6e 64 |or each |net, and|
|00000260| 20 52 41 52 50 0d 09 09 | 09 09 09 3c 4a 6f 68 6e | RARP...|...<John|
|00000270| 20 52 6f 6d 6b 65 79 3e | 0d 09 31 30 2f 33 2f 38 | Romkey>|..10/3/8|
|00000280| 34 20 2d 20 63 68 61 6e | 67 65 64 20 74 68 65 20 |4 - chan|ged the |
|00000290| 51 20 74 6f 20 61 20 71 | 75 65 75 65 20 2a 20 74 |Q to a q|ueue * t|
|000002a0| 6f 20 6d 61 6b 65 20 73 | 74 72 75 63 74 75 72 65 |o make s|tructure|
|000002b0| 0d 09 09 69 6e 69 74 69 | 61 6c 69 7a 61 74 69 6f |...initi|alizatio|
|000002c0| 6e 20 73 69 6d 70 6c 65 | 72 2e 09 3c 4a 6f 68 6e |n simple|r..<John|
|000002d0| 20 52 6f 6d 6b 65 79 3e | 0d 2a 2f 0d 2f 2a 20 31 | Romkey>|.*/./* 1|
|000002e0| 30 2f 32 34 2f 38 37 20 | 6b 65 76 69 6e 20 61 64 |0/24/87 |kevin ad|
|000002f0| 64 65 64 20 72 6e 65 74 | 20 4e 45 54 20 2a 20 2a |ded rnet| NET * *|
|00000300| 2f 0d 2f 2a 20 34 2f 32 | 30 2f 38 38 20 6b 65 76 |/./* 4/2|0/88 kev|
|00000310| 69 6e 20 61 64 64 65 64 | 20 47 48 20 64 65 66 69 |in added| GH defi|
|00000320| 6e 65 73 20 2a 2f 0d 0d | 23 69 66 6e 64 65 66 09 |nes */..|#ifndef.|
|00000330| 5f 4e 45 54 44 45 46 0d | 0d 23 64 65 66 69 6e 65 |_NETDEF.|.#define|
|00000340| 20 5f 4e 45 54 44 45 46 | 0d 0d 2f 2a 20 6e 65 65 | _NETDEF|../* nee|
|00000350| 64 20 74 6f 20 64 65 66 | 69 6e 65 20 74 68 69 73 |d to def|ine this|
|00000360| 20 62 65 66 6f 72 65 20 | 64 72 61 67 67 69 6e 67 | before |dragging|
|00000370| 20 69 6e 20 63 75 73 74 | 6f 6d 2e 68 20 2a 2f 0d | in cust|om.h */.|
|00000380| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 74 61 73 6b 2e |.#includ|e <task.|
|00000390| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 71 2e 68 |h>.#incl|ude <q.h|
|000003a0| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 6e 65 74 71 |>.#inclu|de <netq|
|000003b0| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 63 75 |.h>.#inc|lude <cu|
|000003c0| 73 74 6f 6d 2e 68 3e 0d | 0d 2f 2a 20 54 68 69 73 |stom.h>.|./* This|
|000003d0| 20 69 73 20 74 68 65 20 | 6e 65 74 20 73 74 72 75 | is the |net stru|
|000003e0| 63 74 75 72 65 2e 20 54 | 68 69 73 20 69 64 65 61 |cture. T|his idea|
|000003f0| 20 69 73 20 62 61 73 65 | 64 20 73 6f 6d 65 77 68 | is base|d somewh|
|00000400| 61 74 20 6f 6e 20 4e 6f | 65 6c 27 73 20 43 0d 09 |at on No|el's C..|
|00000410| 47 61 74 65 77 61 79 2e | 20 46 6f 72 20 74 68 65 |Gateway.| For the|
|00000420| 20 49 42 4d 27 73 2c 20 | 77 65 20 6e 65 65 64 20 | IBM's, |we need |
|00000430| 61 6e 20 65 61 73 79 20 | 77 61 79 20 74 6f 20 6d |an easy |way to m|
|00000440| 61 6b 65 20 75 70 20 61 | 20 6e 65 74 0d 09 70 72 |ake up a| net..pr|
|00000450| 6f 67 72 61 6d 20 74 68 | 61 74 20 63 61 6e 20 75 |ogram th|at can u|
|00000460| 73 65 20 61 6e 79 20 6f | 66 20 74 68 65 20 74 68 |se any o|f the th|
|00000470| 72 65 65 20 70 6f 74 65 | 6e 74 69 61 6c 20 6e 65 |ree pote|ntial ne|
|00000480| 74 73 20 74 68 61 74 20 | 74 68 65 0d 09 49 42 4d |ts that |the..IBM|
|00000490| 20 63 61 6e 20 62 65 20 | 69 6e 74 65 72 66 61 63 | can be |interfac|
|000004a0| 65 64 20 74 6f 3a 20 74 | 68 65 20 53 65 72 69 61 |ed to: t|he Seria|
|000004b0| 6c 20 4c 69 6e 65 20 6e | 65 74 20 77 2f 50 43 20 |l Line n|et w/PC |
|000004c0| 47 61 74 65 77 61 79 2c | 20 74 68 65 0d 09 31 30 |Gateway,| the..10|
|000004d0| 20 4d 62 20 45 74 68 65 | 72 6e 65 74 20 6f 72 20 | Mb Ethe|rnet or |
|000004e0| 61 20 50 61 63 6b 65 74 | 20 52 61 64 69 6f 20 73 |a Packet| Radio s|
|000004f0| 65 74 75 70 2e 0d 09 20 | 20 20 54 68 65 20 63 6f |etup... | The co|
|00000500| 64 65 20 66 6f 72 20 65 | 61 63 68 20 6e 65 74 20 |de for e|ach net |
|00000510| 68 61 73 20 74 6f 20 73 | 75 70 70 6c 79 20 61 20 |has to s|upply a |
|00000520| 72 6f 75 74 69 6e 65 20 | 74 6f 20 73 65 6e 64 20 |routine |to send |
|00000530| 70 61 63 6b 65 74 73 0d | 09 6f 76 65 72 20 74 68 |packets.|.over th|
|00000540| 65 20 6e 65 74 2c 20 61 | 20 72 6f 75 74 69 6e 65 |e net, a| routine|
|00000550| 20 74 6f 20 72 65 63 65 | 69 76 65 20 70 61 63 6b | to rece|ive pack|
|00000560| 65 74 73 20 61 6e 64 20 | 61 20 72 6f 75 74 69 6e |ets and |a routin|
|00000570| 65 20 74 6f 0d 09 64 6f | 20 6e 65 74 20 69 6e 69 |e to..do| net ini|
|00000580| 74 69 61 6c 69 7a 61 74 | 69 6f 6e 2e 20 54 68 65 |tializat|ion. The|
|00000590| 20 69 6e 69 74 20 72 6f | 75 74 69 6e 65 20 66 69 | init ro|utine fi|
|000005a0| 6e 64 73 20 74 68 65 20 | 49 42 4d 27 73 20 61 64 |nds the |IBM's ad|
|000005b0| 64 72 65 73 73 0d 09 6f | 6e 20 74 68 61 74 20 6e |dress..o|n that n|
|000005c0| 65 74 2e 20 41 6c 6c 20 | 61 64 64 72 65 73 73 65 |et. All |addresse|
|000005d0| 73 20 61 72 65 20 69 6e | 74 65 72 6e 65 74 20 61 |s are in|ternet a|
|000005e0| 64 64 72 65 73 73 65 73 | 3b 20 61 6e 79 20 6c 6f |ddresses|; any lo|
|000005f0| 63 61 6c 0d 09 61 64 64 | 72 65 73 73 65 73 20 63 |cal..add|resses c|
|00000600| 61 6e 20 62 65 20 6b 65 | 70 74 20 69 6e 20 73 74 |an be ke|pt in st|
|00000610| 61 74 69 63 73 20 62 79 | 20 74 68 65 20 6e 65 74 |atics by| the net|
|00000620| 20 64 72 69 76 65 72 73 | 2e 0d 09 20 20 20 54 6f | drivers|... To|
|00000630| 20 75 73 65 20 74 68 69 | 73 2c 20 74 68 65 20 75 | use thi|s, the u|
|00000640| 73 65 72 20 63 72 65 61 | 74 65 73 20 61 20 43 20 |ser crea|tes a C |
|00000650| 70 72 6f 67 72 61 6d 20 | 77 68 69 63 68 20 6a 75 |program |which ju|
|00000660| 73 74 20 63 6f 6e 73 69 | 73 74 73 0d 09 6f 66 20 |st consi|sts..of |
|00000670| 74 68 65 20 67 6c 6f 62 | 61 6c 20 73 74 72 75 63 |the glob|al struc|
|00000680| 74 75 72 65 20 63 61 6c | 6c 65 64 20 6e 65 74 73 |ture cal|led nets|
|00000690| 20 77 68 69 63 68 20 69 | 73 20 61 6e 20 61 72 72 | which i|s an arr|
|000006a0| 61 79 20 6f 66 20 6e 65 | 74 20 73 74 72 75 63 74 |ay of ne|t struct|
|000006b0| 73 2e 0d 09 54 68 65 20 | 6e 65 74 69 6e 69 74 20 |s...The |netinit |
|000006c0| 72 6f 75 74 69 6e 65 20 | 77 69 6c 6c 20 64 6f 20 |routine |will do |
|000006d0| 74 68 65 20 72 69 67 68 | 74 20 74 68 69 6e 67 20 |the righ|t thing |
|000006e0| 77 69 74 68 20 61 6c 6c | 20 74 68 65 20 69 6e 66 |with all| the inf|
|000006f0| 6f 20 70 72 6f 76 69 64 | 65 64 0d 09 77 68 65 6e |o provid|ed..when|
|00000700| 20 63 61 6c 6c 65 64 2c | 20 61 6e 64 20 77 69 6c | called,| and wil|
|00000710| 6c 20 63 61 6c 6c 20 65 | 61 63 68 20 6e 65 74 27 |l call e|ach net'|
|00000720| 73 20 69 6e 69 74 69 61 | 6c 69 7a 61 74 69 6f 6e |s initia|lization|
|00000730| 20 72 6f 75 74 69 6e 65 | 73 2e 0d 09 54 68 65 20 | routine|s...The |
|00000740| 75 73 65 72 20 6d 75 73 | 74 20 69 6e 63 6c 75 64 |user mus|t includ|
|00000750| 65 20 61 20 76 61 72 69 | 61 62 6c 65 2c 20 69 6e |e a vari|able, in|
|00000760| 74 20 4e 6e 65 74 2c 20 | 69 6e 20 74 68 69 73 20 |t Nnet, |in this |
|00000770| 66 69 6c 65 20 77 69 74 | 68 20 74 68 65 0d 09 73 |file wit|h the..s|
|00000780| 74 61 74 65 6d 65 6e 74 | 3a 0d 09 09 69 6e 74 20 |tatement|:...int |
|00000790| 4e 6e 65 74 20 3d 20 73 | 69 7a 65 6f 66 28 6e 65 |Nnet = s|izeof(ne|
|000007a0| 74 73 29 2f 73 69 7a 65 | 6f 66 28 73 74 72 75 63 |ts)/size|of(struc|
|000007b0| 74 20 6e 65 74 29 3b 0d | 09 54 68 69 73 20 70 72 |t net);.|.This pr|
|000007c0| 6f 76 69 64 65 73 20 61 | 20 77 61 79 20 66 6f 72 |ovides a| way for|
|000007d0| 20 6e 65 74 69 6e 69 74 | 20 74 6f 20 74 65 6c 6c | netinit| to tell|
|000007e0| 20 68 6f 77 20 6d 61 6e | 79 20 6e 65 74 73 20 74 | how man|y nets t|
|000007f0| 68 65 72 65 20 61 72 65 | 2e 20 2a 2f 0d 0d 0d 23 |here are|. */...#|
|00000800| 64 65 66 69 6e 65 09 49 | 50 09 30 0d 23 64 65 66 |define.I|P.0.#def|
|00000810| 69 6e 65 09 43 48 41 4f | 53 09 31 0d 23 64 65 66 |ine.CHAO|S.1.#def|
|00000820| 69 6e 65 09 50 55 50 09 | 32 0d 23 64 65 66 69 6e |ine.PUP.|2.#defin|
|00000830| 65 20 41 52 50 20 33 0d | 0d 2f 2a 20 73 74 61 6e |e ARP 3.|./* stan|
|00000840| 66 6f 72 64 20 64 65 66 | 69 6e 65 73 20 2a 2f 0d |ford def|ines */.|
|00000850| 23 64 65 66 69 6e 65 09 | 53 4c 50 09 33 0d 23 64 |#define.|SLP.3.#d|
|00000860| 65 66 69 6e 65 09 41 44 | 52 09 34 09 2f 2a 20 44 |efine.AD|R.4./* D|
|00000870| 61 76 65 20 50 6c 75 6d | 6d 65 72 27 73 20 41 64 |ave Plum|mer's Ad|
|00000880| 64 72 65 73 73 20 52 65 | 73 6f 6c 75 74 69 6f 6e |dress Re|solution|
|00000890| 20 50 72 6f 74 6f 63 6f | 6c 20 2a 2f 0d 23 64 65 | Protoco|l */.#de|
|000008a0| 66 69 6e 65 09 52 41 52 | 50 09 35 09 2f 2a 20 72 |fine.RAR|P.5./* r|
|000008b0| 65 76 65 72 73 65 20 61 | 64 64 72 65 73 73 20 72 |everse a|ddress r|
|000008c0| 65 73 6f 6c 75 74 69 6f | 6e 20 70 72 6f 74 6f 63 |esolutio|n protoc|
|000008d0| 6f 6c 20 2a 2f 0d 0d 74 | 79 70 65 64 65 66 20 6c |ol */..t|ypedef l|
|000008e0| 6f 6e 67 20 69 6e 5f 6e | 61 6d 65 3b 0d 0d 2f 2a |ong in_n|ame;../*|
|000008f0| 20 54 68 65 20 4e 45 54 | 20 73 74 72 75 63 74 20 | The NET| struct |
|00000900| 68 61 73 20 61 6c 6c 20 | 74 68 65 20 61 63 74 75 |has all |the actu|
|00000910| 61 6c 20 69 6e 74 65 72 | 66 61 63 65 20 63 68 61 |al inter|face cha|
|00000920| 72 61 63 74 65 72 69 73 | 74 69 63 73 20 77 68 69 |racteris|tics whi|
|00000930| 63 68 20 61 72 65 0d 09 | 76 69 73 69 62 6c 65 20 |ch are..|visible |
|00000940| 61 74 20 74 68 65 20 69 | 6e 74 65 72 6e 65 74 20 |at the i|nternet |
|00000950| 6c 65 76 65 6c 20 61 6e | 64 20 68 61 73 20 70 6f |level an|d has po|
|00000960| 69 6e 74 65 72 73 20 74 | 6f 20 74 68 65 20 69 6e |inters t|o the in|
|00000970| 74 65 72 66 61 63 65 0d | 09 68 61 6e 64 6c 69 6e |terface.|.handlin|
|00000980| 67 20 72 6f 75 74 69 6e | 65 73 2e 09 2a 2f 0d 0d |g routin|es..*/..|
|00000990| 73 74 72 75 63 74 20 6e | 65 74 20 7b 0d 09 63 68 |struct n|et {..ch|
|000009a0| 61 72 09 2a 6e 5f 6e 61 | 6d 65 3b 09 2f 2a 20 30 |ar.*n_na|me;./* 0|
|000009b0| 30 20 74 68 65 20 6e 65 | 74 27 73 20 6e 61 6d 65 |0 the ne|t's name|
|000009c0| 20 69 6e 20 61 73 63 69 | 69 20 2a 2f 0d 09 69 6e | in asci|i */..in|
|000009d0| 74 09 28 2a 6e 5f 69 6e | 69 74 29 28 29 3b 09 2f |t.(*n_in|it)();./|
|000009e0| 2a 20 30 34 20 74 68 65 | 20 6e 65 74 20 69 6e 69 |* 04 the| net ini|
|000009f0| 74 69 61 6c 69 7a 61 74 | 69 6f 6e 20 72 6f 75 74 |tializat|ion rout|
|00000a00| 69 6e 65 20 2a 2f 0d 09 | 69 6e 74 09 28 2a 6e 5f |ine */..|int.(*n_|
|00000a10| 73 65 6e 64 29 28 29 3b | 09 2f 2a 20 30 38 20 74 |send)();|./* 08 t|
|00000a20| 68 65 20 70 61 63 6b 65 | 74 20 78 6d 69 74 20 72 |he packe|t xmit r|
|00000a30| 6f 75 74 69 6e 65 20 2a | 2f 0d 09 69 6e 74 09 28 |outine *|/..int.(|
|00000a40| 2a 6e 5f 6f 70 65 6e 29 | 28 29 3b 09 2f 2a 20 31 |*n_open)|();./* 1|
|00000a50| 32 20 74 68 65 20 70 72 | 6f 74 6f 63 6f 6c 20 6f |2 the pr|otocol o|
|00000a60| 70 65 6e 20 72 6f 75 74 | 69 6e 65 20 2a 2f 0d 09 |pen rout|ine */..|
|00000a70| 69 6e 74 09 28 2a 6e 5f | 63 6c 6f 73 65 29 28 29 |int.(*n_|close)()|
|00000a80| 3b 09 2f 2a 20 31 36 20 | 74 68 65 20 70 72 6f 74 |;./* 16 |the prot|
|00000a90| 6f 63 6f 6c 20 63 6c 6f | 73 65 20 72 6f 75 74 69 |ocol clo|se routi|
|00000aa0| 6e 65 20 2a 2f 0d 09 74 | 61 73 6b 09 2a 6e 5f 64 |ne */..t|ask.*n_d|
|00000ab0| 65 6d 75 78 3b 09 2f 2a | 20 32 30 20 70 61 63 6b |emux;./*| 20 pack|
|00000ac0| 65 74 20 64 65 6d 75 6c | 74 69 70 6c 65 78 69 6e |et demul|tiplexin|
|00000ad0| 67 20 74 61 73 6b 20 74 | 6f 20 70 72 6f 74 6f 63 |g task t|o protoc|
|00000ae0| 6f 6c 20 2a 2f 0d 09 71 | 75 65 75 65 09 2a 6e 5f |ol */..q|ueue.*n_|
|00000af0| 69 6e 70 75 74 71 3b 09 | 2f 2a 20 32 34 20 74 68 |inputq;.|/* 24 th|
|00000b00| 65 20 71 75 65 75 65 20 | 6f 66 20 72 65 63 65 69 |e queue |of recei|
|00000b10| 76 65 64 20 70 61 63 6b | 65 74 73 20 2a 2f 0d 09 |ved pack|ets */..|
|00000b20| 75 6e 73 69 67 6e 65 64 | 20 6e 5f 69 6e 69 74 70 |unsigned| n_initp|
|00000b30| 31 3b 09 2f 2a 20 32 38 | 20 69 6e 69 74 69 61 6c |1;./* 28| initial|
|00000b40| 69 7a 61 74 69 6f 6e 20 | 70 61 72 61 6d 65 74 65 |ization |paramete|
|00000b50| 72 20 6f 6e 65 20 2a 2f | 0d 09 75 6e 73 69 67 6e |r one */|..unsign|
|00000b60| 65 64 20 6e 5f 69 6e 69 | 74 70 32 3b 09 2f 2a 20 |ed n_ini|tp2;./* |
|00000b70| 33 30 09 22 09 20 20 20 | 20 20 22 09 20 20 20 20 |30.". | ". |
|00000b80| 74 77 6f 20 2a 2f 0d 09 | 69 6e 74 09 6e 5f 73 74 |two */..|int.n_st|
|00000b90| 6b 73 69 7a 3b 09 2f 2a | 20 33 32 20 6e 65 74 20 |ksiz;./*| 32 net |
|00000ba0| 74 61 73 6b 20 69 6e 69 | 74 69 61 6c 20 73 74 61 |task ini|tial sta|
|00000bb0| 63 6b 20 73 69 7a 65 20 | 2a 2f 0d 09 69 6e 74 09 |ck size |*/..int.|
|00000bc0| 6e 5f 6c 6e 68 3b 09 09 | 2f 2a 20 33 34 20 74 68 |n_lnh;..|/* 34 th|
|00000bd0| 65 20 6e 65 74 27 73 20 | 6c 6f 63 61 6c 20 6e 65 |e net's |local ne|
|00000be0| 74 20 68 65 61 64 65 72 | 20 20 73 69 7a 65 20 2a |t header| size *|
|00000bf0| 2f 0d 09 69 6e 74 09 6e | 5f 6c 6e 74 3b 09 09 2f |/..int.n|_lnt;../|
|00000c00| 2a 20 33 36 20 74 68 65 | 20 6e 65 74 27 73 20 6c |* 36 the| net's l|
|00000c10| 6f 63 61 6c 20 6e 65 74 | 20 74 72 61 69 6c 65 72 |ocal net| trailer|
|00000c20| 20 73 69 7a 65 20 2a 2f | 0d 09 69 6e 5f 6e 61 6d | size */|..in_nam|
|00000c30| 65 09 69 70 5f 61 64 64 | 72 3b 09 2f 2a 20 33 38 |e.ip_add|r;./* 38|
|00000c40| 20 74 68 65 20 69 6e 74 | 65 72 66 61 63 65 27 73 | the int|erface's|
|00000c50| 20 69 6e 74 65 72 6e 65 | 74 20 61 64 64 72 65 73 | interne|t addres|
|00000c60| 73 20 2a 2f 0d 09 69 6e | 74 09 28 2a 6e 5f 73 74 |s */..in|t.(*n_st|
|00000c70| 61 74 73 29 28 29 3b 09 | 2f 2a 20 34 32 20 2e 2e |ats)();.|/* 42 ..|
|00000c80| 2e 20 70 65 72 20 6e 65 | 74 20 73 74 61 74 69 73 |. per ne|t statis|
|00000c90| 74 69 63 73 20 2a 2f 0d | 09 69 6e 5f 6e 61 6d 65 |tics */.|.in_name|
|00000ca0| 20 6e 5f 64 65 66 67 77 | 3b 09 2f 2a 20 34 36 20 | n_defgw|;./* 46 |
|00000cb0| 74 68 65 20 64 65 66 61 | 75 6c 74 20 67 61 74 65 |the defa|ult gate|
|00000cc0| 77 61 79 20 66 6f 72 20 | 74 68 69 73 20 6e 65 74 |way for |this net|
|00000cd0| 20 2a 2f 0d 09 73 74 72 | 75 63 74 20 63 75 73 74 | */..str|uct cust|
|00000ce0| 6f 6d 09 2a 6e 5f 63 75 | 73 74 6f 6d 3b 09 2f 2a |om.*n_cu|stom;./*|
|00000cf0| 20 35 30 20 6e 65 74 27 | 73 20 63 75 73 74 6f 6d | 50 net'|s custom|
|00000d00| 20 73 74 72 75 63 74 75 | 72 65 20 2a 2f 0d 09 69 | structu|re */..i|
|00000d10| 6e 74 09 28 2a 6e 5f 73 | 75 73 70 29 28 29 3b 09 |nt.(*n_s|usp)();.|
|00000d20| 2f 2a 20 35 34 20 70 72 | 6f 74 6f 63 6f 6c 20 73 |/* 54 pr|otocol s|
|00000d30| 75 73 70 65 6e 64 20 72 | 6f 75 74 69 6e 65 20 66 |uspend r|outine f|
|00000d40| 6f 72 20 53 77 69 74 63 | 68 65 72 20 2a 2f 0d 09 |or Switc|her */..|
|00000d50| 69 6e 74 09 28 2a 6e 5f | 73 75 62 6e 65 74 29 28 |int.(*n_|subnet)(|
|00000d60| 29 3b 09 2f 2a 20 35 38 | 20 70 72 6f 74 6f 63 6f |);./* 58| protoco|
|00000d70| 6c 20 73 75 62 6e 65 74 | 20 72 6f 75 74 69 6e 65 |l subnet| routine|
|00000d80| 20 2a 2f 0d 7d 3b 0d 0d | 0d 74 79 70 65 64 65 66 | */.};..|.typedef|
|00000d90| 20 73 74 72 75 63 74 20 | 6e 65 74 20 4e 45 54 3b | struct |net NET;|
|00000da0| 0d 0d 2f 2a 20 48 65 72 | 65 20 61 72 65 20 74 68 |../* Her|e are th|
|00000db0| 65 20 64 65 62 75 67 67 | 69 6e 67 20 74 68 69 6e |e debugg|ing thin|
|00000dc0| 67 73 2e 20 44 45 42 55 | 47 20 69 73 20 61 20 67 |gs. DEBU|G is a g|
|00000dd0| 6c 6f 62 61 6c 20 76 61 | 72 69 61 62 6c 65 20 77 |lobal va|riable w|
|00000de0| 68 6f 73 65 20 76 61 6c | 75 65 0d 09 64 65 74 65 |hose val|ue..dete|
|00000df0| 72 6d 69 6e 65 73 20 77 | 68 61 74 20 73 6f 72 74 |rmines w|hat sort|
|00000e00| 20 6f 66 20 64 65 62 75 | 67 67 69 6e 67 20 6d 65 | of debu|gging me|
|00000e10| 73 73 61 67 65 73 20 77 | 69 6c 6c 20 62 65 20 64 |ssages w|ill be d|
|00000e20| 69 73 70 6c 61 79 65 64 | 20 62 79 0d 09 74 68 65 |isplayed| by..the|
|00000e30| 20 73 79 73 74 65 6d 2e | 20 2a 2f 0d 0d 65 78 74 | system.| */..ext|
|00000e40| 65 72 6e 20 75 6e 73 69 | 67 6e 65 64 20 4e 44 45 |ern unsi|gned NDE|
|00000e50| 42 55 47 3b 09 09 2f 2a | 20 44 65 62 75 67 67 69 |BUG;../*| Debuggi|
|00000e60| 6e 67 20 6f 70 74 69 6f | 6e 73 20 2a 2f 0d 65 78 |ng optio|ns */.ex|
|00000e70| 74 65 72 6e 20 69 6e 74 | 20 4d 61 78 4c 6e 68 3b |tern int| MaxLnh;|
|00000e80| 09 09 2f 2a 20 4c 61 72 | 67 65 73 74 20 6c 6f 63 |../* Lar|gest loc|
|00000e90| 61 6c 20 6e 65 74 20 68 | 65 61 64 65 72 20 73 69 |al net h|eader si|
|00000ea0| 7a 65 20 2a 2f 0d 65 78 | 74 65 72 6e 20 75 6e 73 |ze */.ex|tern uns|
|00000eb0| 69 67 6e 65 64 20 76 65 | 72 73 69 6f 6e 3b 09 2f |igned ve|rsion;./|
|00000ec0| 2a 20 70 72 6f 67 72 61 | 6d 20 76 65 72 73 69 6f |* progra|m versio|
|00000ed0| 6e 20 6e 75 6d 62 65 72 | 20 2a 2f 0d 65 78 74 65 |n number| */.exte|
|00000ee0| 72 6e 20 69 6e 74 20 4e | 6e 65 74 3b 0d 65 78 74 |rn int N|net;.ext|
|00000ef0| 65 72 6e 20 4e 45 54 20 | 2a 20 72 6e 65 74 3b 0d |ern NET |* rnet;.|
|00000f00| 65 78 74 65 72 6e 20 4e | 45 54 20 6e 65 74 73 5b |extern N|ET nets[|
|00000f10| 5d 3b 0d 65 78 74 65 72 | 6e 20 69 6e 74 20 6e 65 |];.exter|n int ne|
|00000f20| 74 69 64 3b 09 09 09 2f | 2a 20 6f 66 66 73 65 74 |tid;.../|* offset|
|00000f30| 20 69 6e 74 6f 20 6e 65 | 74 73 5b 5d 20 6f 66 20 | into ne|ts[] of |
|00000f40| 63 75 72 72 65 6e 74 20 | 6e 65 74 20 2a 2f 0d 0d |current |net */..|
|00000f50| 23 64 65 66 69 6e 65 09 | 42 55 47 48 41 4c 54 09 |#define.|BUGHALT.|
|00000f60| 09 31 09 2f 2a 20 42 55 | 47 48 41 4c 54 20 6f 6e |.1./* BU|GHALT on|
|00000f70| 20 61 20 67 72 6f 73 73 | 20 61 70 70 6c 69 63 61 | a gross| applica|
|00000f80| 74 69 6f 6e 73 20 6c 65 | 76 65 6c 20 65 72 72 6f |tions le|vel erro|
|00000f90| 72 0d 09 09 09 09 09 74 | 68 61 74 20 69 73 20 64 |r......t|hat is d|
|00000fa0| 65 74 65 63 74 65 64 20 | 69 6e 20 74 68 65 20 6e |etected |in the n|
|00000fb0| 65 74 77 6f 72 6b 20 63 | 6f 64 65 20 2a 2f 0d 0d |etwork c|ode */..|
|00000fc0| 23 64 65 66 69 6e 65 09 | 44 55 4d 50 09 09 32 09 |#define.|DUMP..2.|
|00000fd0| 2f 2a 20 44 6f 20 61 20 | 64 75 6d 70 20 6f 66 20 |/* Do a |dump of |
|00000fe0| 61 6c 6c 20 62 61 64 20 | 69 6e 63 6f 6d 69 6e 67 |all bad |incoming|
|00000ff0| 20 70 61 63 6b 65 74 73 | 20 2a 2f 0d 0d 23 64 65 | packets| */..#de|
|00001000| 66 69 6e 65 09 49 4e 46 | 4f 4d 53 47 09 09 34 09 |fine.INF|OMSG..4.|
|00001010| 2f 2a 20 50 72 69 6e 74 | 20 69 6e 66 6f 72 6d 61 |/* Print| informa|
|00001020| 74 69 6f 6e 61 6c 20 6d | 65 73 73 61 67 65 73 20 |tional m|essages |
|00001030| 73 75 63 68 20 61 73 20 | 70 61 63 6b 65 74 0d 09 |such as |packet..|
|00001040| 09 09 09 09 72 65 63 65 | 69 76 65 64 2c 20 65 74 |....rece|ived, et|
|00001050| 63 2e 20 2a 2f 0d 0d 23 | 64 65 66 69 6e 65 09 4e |c. */..#|define.N|
|00001060| 45 54 45 52 52 09 09 38 | 09 2f 2a 20 44 69 73 70 |ETERR..8|./* Disp|
|00001070| 6c 61 79 20 6e 65 74 20 | 69 6e 74 65 72 66 61 63 |lay net |interfac|
|00001080| 65 20 65 72 72 6f 72 20 | 6d 65 73 73 61 67 65 73 |e error |messages|
|00001090| 20 2a 2f 0d 0d 23 64 65 | 66 69 6e 65 09 50 52 4f | */..#de|fine.PRO|
|000010a0| 54 45 52 52 09 09 31 36 | 09 2f 2a 20 44 69 73 70 |TERR..16|./* Disp|
|000010b0| 6c 61 79 20 70 72 6f 74 | 6f 63 6f 6c 20 6c 65 76 |lay prot|ocol lev|
|000010c0| 65 6c 20 65 72 72 6f 72 | 20 6d 65 73 73 61 67 65 |el error| message|
|000010d0| 73 20 2a 2f 0d 0d 23 64 | 65 66 69 6e 65 09 54 52 |s */..#d|efine.TR|
|000010e0| 41 43 45 09 09 33 32 09 | 2f 2a 20 54 72 61 63 65 |ACE..32.|/* Trace|
|000010f0| 20 70 61 63 6b 65 74 20 | 74 68 72 6f 75 67 68 20 | packet |through |
|00001100| 70 72 6f 74 6f 63 6f 6c | 20 6c 61 79 65 72 73 20 |protocol| layers |
|00001110| 2a 2f 0d 0d 23 64 65 66 | 69 6e 65 20 4e 45 54 52 |*/..#def|ine NETR|
|00001120| 41 43 45 09 09 33 32 09 | 2f 2a 20 54 72 61 63 65 |ACE..32.|/* Trace|
|00001130| 20 70 61 63 6b 65 74 20 | 69 6e 20 6c 69 6e 6b 20 | packet |in link |
|00001140| 6c 65 76 65 6c 20 6e 65 | 74 20 6c 61 79 65 72 20 |level ne|t layer |
|00001150| 2a 2f 0d 0d 23 64 65 66 | 69 6e 65 20 49 4e 54 52 |*/..#def|ine INTR|
|00001160| 41 43 45 09 09 33 32 09 | 2f 2a 20 54 72 61 63 65 |ACE..32.|/* Trace|
|00001170| 20 70 61 63 6b 65 74 20 | 69 6e 20 69 6e 74 65 72 | packet |in inter|
|00001180| 6e 65 74 20 6c 61 79 65 | 72 20 20 2a 2f 0d 0d 23 |net laye|r */..#|
|00001190| 64 65 66 69 6e 65 20 54 | 43 54 52 41 43 45 09 09 |define T|CTRACE..|
|000011a0| 33 32 09 2f 2a 20 54 72 | 61 6e 73 6d 69 73 73 69 |32./* Tr|ansmissi|
|000011b0| 6f 6e 20 63 6f 6e 74 72 | 6f 6c 20 28 55 44 50 2c |on contr|ol (UDP,|
|000011c0| 20 54 43 50 29 20 74 72 | 61 63 65 20 2a 2f 0d 0d | TCP) tr|ace */..|
|000011d0| 23 64 65 66 69 6e 65 20 | 41 50 54 52 41 43 45 09 |#define |APTRACE.|
|000011e0| 09 31 32 38 09 2f 2a 20 | 54 72 61 63 65 20 70 61 |.128./* |Trace pa|
|000011f0| 63 6b 65 74 20 74 68 72 | 6f 75 67 68 20 61 70 70 |cket thr|ough app|
|00001200| 6c 69 63 61 74 69 6f 6e | 20 2a 2f 0d 0d 23 64 65 |lication| */..#de|
|00001210| 66 69 6e 65 09 54 4d 4f | 09 09 36 34 09 2f 2a 20 |fine.TMO|..64./* |
|00001220| 50 72 69 6e 74 20 6d 65 | 73 73 61 67 65 20 6f 6e |Print me|ssage on|
|00001230| 20 74 69 6d 65 6f 75 74 | 20 2a 2f 0d 0d 23 64 65 | timeout| */..#de|
|00001240| 66 69 6e 65 09 52 4f 55 | 54 45 09 09 31 32 38 09 |fine.ROU|TE..128.|
|00001250| 2f 2a 20 74 75 72 6e 20 | 6f 6e 20 72 6f 75 74 69 |/* turn |on routi|
|00001260| 6e 67 20 74 72 61 63 69 | 6e 67 20 2a 2f 0d 0d 23 |ng traci|ng */..#|
|00001270| 64 65 66 69 6e 65 09 54 | 43 50 54 52 41 43 45 09 |define.T|CPTRACE.|
|00001280| 32 35 36 0d 0d 2f 2a 20 | 20 54 68 65 20 66 6f 6c |256../* | The fol|
|00001290| 6c 6f 77 69 6e 67 20 74 | 77 6f 20 64 65 66 69 6e |lowing t|wo defin|
|000012a0| 69 74 69 6f 6e 73 20 70 | 72 6f 76 69 64 65 20 61 |itions p|rovide a|
|000012b0| 20 73 74 61 6e 64 61 72 | 64 20 77 61 79 20 66 6f | standar|d way fo|
|000012c0| 72 20 6f 6e 65 20 6e 65 | 74 20 6c 65 76 65 6c 0d |r one ne|t level.|
|000012d0| 74 6f 20 74 65 6c 6c 20 | 74 68 65 20 6e 65 78 74 |to tell |the next|
|000012e0| 20 74 68 61 74 20 74 68 | 69 6e 67 73 20 77 6f 72 | that th|ings wor|
|000012f0| 6b 65 64 20 6f 75 74 20 | 61 73 20 68 6f 70 65 64 |ked out |as hoped|
|00001300| 20 6f 72 20 74 68 61 74 | 20 74 68 65 79 20 64 69 | or that| they di|
|00001310| 64 6e 27 74 2e 20 20 2a | 2f 0d 0d 23 64 65 66 69 |dn't. *|/..#defi|
|00001320| 6e 65 20 53 55 43 43 45 | 53 53 09 09 31 0d 0d 23 |ne SUCCE|SS..1..#|
|00001330| 64 65 66 69 6e 65 20 46 | 41 49 4c 55 52 45 09 09 |define F|AILURE..|
|00001340| 2d 31 0d 0d 2f 2a 20 66 | 6c 61 67 73 20 66 6f 72 |-1../* f|lags for|
|00001350| 20 67 65 74 5f 68 6f 73 | 74 2c 20 77 68 69 63 68 | get_hos|t, which|
|00001360| 20 62 75 74 74 6f 6e 20 | 74 6f 20 68 69 67 68 6c | button |to highl|
|00001370| 69 67 68 74 20 2a 2f 0d | 23 64 65 66 69 6e 65 20 |ight */.|#define |
|00001380| 47 48 5f 4f 50 45 4e 09 | 31 0d 23 64 65 66 69 6e |GH_OPEN.|1.#defin|
|00001390| 65 20 47 48 5f 51 55 49 | 54 09 32 0d 23 64 65 66 |e GH_QUI|T.2.#def|
|000013a0| 69 6e 65 20 47 48 5f 53 | 45 54 09 33 0d 0d 0d 23 |ine GH_S|ET.3...#|
|000013b0| 65 6e 64 69 66 0d 0d 00 | 00 00 00 00 00 00 00 00 |endif...|........|
|000013c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001400| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2|
|00001410| 61 6e 64 61 72 64 20 77 | 61 79 20 66 6f 72 20 6f |andard w|ay for o|
|00001420| 6e 65 20 6e 65 74 20 6c | 65 76 65 6c 0d 74 6f 20 |ne net l|evel.to |
|00001430| 05 6e 65 74 2e 68 02 00 | 00 00 50 61 72 74 53 49 |.net.h..|..PartSI|
|00001440| 54 78 00 00 00 00 00 00 | 00 00 00 01 8c 0c 00 00 |Tx......|........|
|00001450| 00 00 50 61 72 74 53 49 | 54 78 00 00 00 00 00 00 |..PartSI|Tx......|
|00001460| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001470| 00 00 a9 8d 3a 84 00 00 | 00 00 00 00 01 7e 65 20 |....:...|.....~e |
|00001480| 53 55 43 43 45 53 53 09 | 09 31 0d 0d 23 64 65 66 |SUCCESS.|.1..#def|
|00001490| 69 6e 65 20 46 41 49 4c | 55 52 45 09 09 2d 31 0d |ine FAIL|URE..-1.|
|000014a0| 0d 2f 2a 20 66 6c 61 67 | 73 20 66 6f 72 20 67 65 |./* flag|s for ge|
|000014b0| 74 5f 68 6f 73 74 2c 20 | 77 68 69 63 68 20 62 75 |t_host, |which bu|
|000014c0| 74 74 6f 6e 20 74 6f 20 | 68 69 67 68 6c 69 67 68 |tton to |highligh|
|000014d0| 74 20 2a 2f 0d 23 64 65 | 66 69 6e 65 20 47 48 5f |t */.#de|fine GH_|
|000014e0| 4f 50 45 4e 09 31 0d 23 | 64 65 66 69 6e 65 20 47 |OPEN.1.#|define G|
|000014f0| 48 5f 51 55 49 54 09 32 | 0d 23 64 65 66 69 6e 65 |H_QUIT.2|.#define|
|00001500| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 87 00 70 |...H..Mo|naco...p|
|00001510| 00 87 02 2a 00 92 00 09 | 00 92 00 70 00 00 00 00 |...*....|...p....|
|00001520| 00 00 00 00 00 00 00 06 | 00 04 00 27 00 00 01 e1 |........|...'....|
|00001530| 02 00 00 27 00 00 01 e1 | 02 00 a2 d4 b2 85 00 00 |...'....|........|
|00001540| 0e 7a 00 00 0e 7e 00 00 | 0b a9 01 00 00 00 01 00 |.z...~..|........|
|00001550| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 12 6b 38 |...L...L|...2..k8|
|00001560| 05 e2 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.......2|..MPSR..|
|00001570| 00 0a 03 ed ff ff 00 00 | 00 00 00 13 a0 d4 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+